From:	Warnes, Gregory R
Sent:	Wednesday, March 09, 2005 2:16 PM
To:	Hyde, Craig L
Subject:	RE: R genetics package
There is a function for converting allele counts (0-2) into genotypes:  'as.genotype.allele.count'.


> x <- sample(0:2, 10, replace=T)
> as.genotype.allele.count(x, alleles=c("A","B"))
 [1] "A/A" "B/B" "A/A" "A/B" "A/B" "A/A" "A/A" "A/A" "A/B" "A/B"
Alleles: A B 
> 

To use this with makeGenotypes do:

> df <- data.frame(age=1:10, sex=rep(c('M','F'),5), genotype1=x, genotype2=sample(x))
> df
   age sex genotype1 genotype2
1    1   M         2         2
2    2   F         0         1
3    3   M         2         1
4    4   F         1         2
5    5   M         1         2
6    6   F         2         0
7    7   M         2         2
8    8   F         2         1
9    9   M         1         1
10  10   F         1         2

> makeGenotypes( df, convert=3:4, method=as.genotype.allele.count)
   age sex genotype1 genotype2
1    1   M       A/A       A/A
2    2   F       B/B       A/B
3    3   M       A/A       A/B
4    4   F       A/B       A/A
5    5   M       A/B       A/A
6    6   F       A/A       B/B
7    7   M       A/A       A/A
8    8   F       A/A       A/B
9    9   M       A/B       A/B
10  10   F       A/B       A/A

-Greg

>  -----Original Message-----
> From: 	Hyde, Craig L  
> Sent:	Wednesday, March 09, 2005 12:22 PM
> To:	Warnes, Gregory R
> Subject:	R genetics package
> 
> 
> Greg,
> 
> 	Didn't you claim during on Saturday that the R
> genetics package would convert numeric (0,1,2,) genotypes
> using 'makeGenotypes'?
> 
> 	I can't seems to figure out how this is done.
> (either that, or the function LD does not work on the resulting
> genotype object).  I did update the package. Obviously, I can get by
>  converting manually, but I am just 
> wondering if this is an oversight?
> 
> 			---craig---
> --------------------------------------------------------------
> ------------------
> Craig L. Hyde, Ph.D.
> Manager, Nonclinical Biostatistics, Pharmacogenomics
> Pfizer Global Research and Development
> MS 8260-2235 Eastern Point Rd. (Bldg. 260, Rm. 2413)
> Groton, CT 06340
> Ph: (860) 715 - 0437
> Fax: (860) 715 - 5445
> E-mail: Craig_L_Hyde@groton.pfizer.com
> 